<?php
/**
 * Created by PhpStorm.
 * User: Eric
 * Email: 13522679763@163.com
 * Date: 2018/8/3
 * Time: 21:52
 */

namespace app\admin\controller;
use think\Controller;
use app\common\lib\Aes;
use app\common\lib\IAuth;
class Common extends Controller
{

    /*
     *  初始化方法
     */

    public function  _initialize()
    {
        $this->checkRequestAuth();
        $this->testAes();
    }

    /*
     *  检查每次请求的 数据是否合法
     */
    public  function  checkRequestAuth(){

        //获取头信息
        $header=request()->header();
       // halt($header);
        //sign  加密客户端   解密 服务端 aes

     }

    public function testAes(){
//       $str= '?users=6&id=1&item=45';
//        $aes_new= '';
//        echo (new Aes())->encrypt($str);
//        echo (new Aes())->decrypt('sC5vr6N/zEB69k+aK/hgpxHnzACjLbSEdqTv5tbWZLI='); exit;
       $data=[
           'name'=>'eric',
           'number'=>5
       ];
        $str='SO3eYbdiyVWzOGQtdCL8DQKgB+LkLNzzpX/YBuqTXfI=SO3eYbdiyVWzOGQtdCL8DQKgB+LkLNzzpX/YBuqTXfI=';
    //  echo IAuth::setSign($data);
      echo   (new Aes())->decrypt($str);
    }

}